/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.jinyao.exploit.common.base;

import com.jinyao.exploit.common.base.entity.DataEntity;
import lombok.Data;

import java.util.Date;

/**
 * 用户Entity
 * @author ThinkGem
 * @version 2013-12-05
 */
@Data
public class User extends DataEntity<User> {

	public static final String LOGIN_FLAG_YES = "1";
	public static final String LOGIN_FLAG_NOT= "0";

	private String loginName;// 登录名
	private String password;// 密码
	private String no;		// 工号
	private String name;	// 姓名
	private String email;	// 邮箱
	private String phone;	// 电话
	private String mobile;	// 手机
	private String userType;// 用户类型
	private String loginIp;	// 最后登陆IP
	private Date loginDate;	// 最后登陆日期
	private String loginFlag;	// 是否允许登陆
	private String photo;	// 头像

	private String oldLoginName;// 原登录名
	private String newPassword;	// 新密码
	
	private String oldLoginIp;	// 上次登陆IP
	private Date oldLoginDate;	// 上次登陆日期
	
	public User() {
		super();
		this.loginFlag = Global.YES;
	}
	
	public User(long id){
		super(id);
	}

	public User(long id, String loginName){
		super(id);
		this.loginName = loginName;
	}

	public boolean isAdmin(){
		return isAdmin(this.id);
	}
	
	public static boolean isAdmin(long id){
		return id == 1;
	}
	
}